Friend Class DBConnectSummary
    Inherits DBBase

    Public Sub Load( _
        ByRef oObject As SQLAutoDocLib.ConnectSummary)

        Dim sSQL As String = "select"
        sSQL = sSQL & "     [DatabaseID],"

        sSQL = sSQL & "     [Year],"
        sSQL = sSQL & "     [Month],"
        sSQL = sSQL & "     [Day],"
        sSQL = sSQL & "     [Hour],"
        sSQL = sSQL & "     [SessionCount],"
        sSQL = sSQL & "     [ServerConnections],"
        sSQL = sSQL & "     [DatabaseConnections],"

        sSQL = sSQL & "     [LastUpdateDate],"
        sSQL = sSQL & "     [CreateDate]"
        sSQL = sSQL & " from"
        sSQL = sSQL & "     ConnectSummary"
        sSQL = sSQL & " where"
        sSQL = sSQL & "     [ID]=" & oObject.ID

        Dim oData As DataTable = MyBase.ExecuteReadToDataTable(sSQL)

        If oData.Rows.Count > 0 Then
            With oData.Rows(0)
                oObject.DatabaseID = .Item("DatabaseID")

                oObject.Year = .Item("Year")
                oObject.Month = .Item("Month")
                oObject.Day = .Item("Day")
                oObject.Hour = .Item("Hour")
                oObject.SessionCount = .Item("SessionCount")
                oObject.ServerConnections = .Item("ServerConnections")
                oObject.DatabaseConnections = .Item("DatabaseConnections")
 
                oObject.LastUpdateDate = .Item("LastUpdateDate")
                oObject.CreateDate = .Item("CreateDate")
            End With
        End If

        oData.Dispose()
    End Sub

    Public Sub Add(ByRef oObject As SQLAutoDocLib.ConnectSummary)

        Dim sSQL As String = "insert into ConnectSummary ("
        sSQL = sSQL & "     [ID],"
        sSQL = sSQL & "     [DatabaseID],"

        sSQL = sSQL & "     [Year],"
        sSQL = sSQL & "     [Month],"
        sSQL = sSQL & "     [Day],"
        sSQL = sSQL & "     [Hour],"
        sSQL = sSQL & "     [SessionCount],"
        sSQL = sSQL & "     [ServerConnections],"
        sSQL = sSQL & "     [DatabaseConnections],"

        sSQL = sSQL & "     [LastUpdateDate],"
        sSQL = sSQL & "     [CreateDate]) values ("

        sSQL = sSQL & ValueToDBValue(oObject.ID) & ","
        sSQL = sSQL & ValueToDBValue(oObject.DatabaseID) & ","

        sSQL = sSQL & ValueToDBValue(oObject.Year) & ","
        sSQL = sSQL & ValueToDBValue(oObject.Month) & ","
        sSQL = sSQL & ValueToDBValue(oObject.Day) & ","
        sSQL = sSQL & ValueToDBValue(oObject.Hour) & ","
        sSQL = sSQL & ValueToDBValue(oObject.SessionCount) & ","
        sSQL = sSQL & ValueToDBValue(oObject.ServerConnections) & ","
        sSQL = sSQL & ValueToDBValue(oObject.DatabaseConnections) & ","

        sSQL = sSQL & ValueToDBValue(oObject.LastUpdateDate) & ","
        sSQL = sSQL & ValueToDBValue(oObject.CreateDate) & ")"

        MyBase.ExecuteNonQuery(sSQL)
    End Sub

    Public Sub Update(ByRef oObject As SQLAutoDocLib.ConnectSummary)

        Dim sSQL As String = "update ConnectSummary set"
        sSQL = sSQL & "     [SessionCount]=" & ValueToDBValue(oObject.SessionCount) & ","
        sSQL = sSQL & "     [ServerConnections]=" & ValueToDBValue(oObject.ServerConnections) & ","
        sSQL = sSQL & "     [DatabaseConnections]=" & ValueToDBValue(oObject.DatabaseConnections) & ","
        sSQL = sSQL & "     [LastUpdateDate]=" & ValueToDBValue(oObject.LastUpdateDate)
        sSQL = sSQL & " where"
        sSQL = sSQL & "     [id]=" & oObject.ID

        MyBase.ExecuteNonQuery(sSQL)
    End Sub

    Public Sub Delete(ByRef oObject As SQLAutoDocLib.ConnectSummary)
        Dim sSQL As String = "delete from ConnectSummary"
        sSQL = sSQL & " where"
        sSQL = sSQL & "     [ID]=" & oObject.ID

        MyBase.ExecuteNonQuery(sSQL)
    End Sub
End Class
